
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>同步、异步 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../计算机基础/进程、线程、cpu、内存.md" />
    
    
    <link rel="prev" href="class.md" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    介绍
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Js部分</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="数据类型及判断.html">
            
                <a href="数据类型及判断.html">
            
                    
                    数据类型及判断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="执行上下文、作用域、作用域链、闭包.html">
            
                <a href="执行上下文、作用域、作用域链、闭包.html">
            
                    
                    执行上下文、作用域、作用域链、闭包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="作用域.html">
            
                <a href="作用域.html">
            
                    
                    作用域
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="函数提升、变量提升.html">
            
                <a href="函数提升、变量提升.html">
            
                    
                    函数提升、变量提升
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="原型链.html">
            
                <a href="原型链.html">
            
                    
                    原型链
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="js继承.html">
            
                <a href="js继承.html">
            
                    
                    js继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="深拷贝、浅拷贝.html">
            
                <a href="深拷贝、浅拷贝.html">
            
                    
                    深拷贝、浅拷贝
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="let、const、var区别.html">
            
                <a href="let、const、var区别.html">
            
                    
                    let、const、var区别
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="async、await.html">
            
                <a href="async、await.html">
            
                    
                    async、await
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="模块化.md">
            
                <span>
            
                    
                    模块化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="this、call、bind、apply.html">
            
                <a href="this、call、bind、apply.html">
            
                    
                    this、call、bind、apply
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="算法.md">
            
                <span>
            
                    
                    算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="垃圾回收机制、内存泄漏.md">
            
                <span>
            
                    
                    垃圾回收机制、内存泄漏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="事件机制、js事件绑定.html">
            
                <a href="事件机制、js事件绑定.html">
            
                    
                    事件机制、js事件绑定
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="事件循环.md">
            
                <span>
            
                    
                    事件循环
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.16" data-path="Promise.md">
            
                <span>
            
                    
                    Promise
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.17" data-path="class.md">
            
                <span>
            
                    
                    class
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.18" data-path="同步、异步.html">
            
                <a href="同步、异步.html">
            
                    
                    同步、异步
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">计算机基础</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../计算机基础/进程、线程、cpu、内存.md">
            
                <span>
            
                    
                    进程、线程、cpu、内存
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">游览器</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../游览器/游览器渲染机制、输入url,游览器执行过程.md">
            
                <span>
            
                    
                    游览器渲染机制、输入url,游览器执行过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../游览器/游览器缓存机制.md">
            
                <span>
            
                    
                    游览器缓存机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../游览器/同源策略、跨域解决问题.md">
            
                <span>
            
                    
                    同源策略、跨域解决问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="../游览器/ajax原理，es6写法.md">
            
                <span>
            
                    
                    ajax原理，es6写法
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">框架</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../框架/生命周期、钩子函数.md">
            
                <span>
            
                    
                    生命周期、钩子函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../框架/虚拟DOM、diff算法.md">
            
                <span>
            
                    
                    虚拟DOM、diff算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../框架/组件通信.md">
            
                <span>
            
                    
                    组件通信
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../框架/状态管理.md">
            
                <span>
            
                    
                    状态管理
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">webpack</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../webpack/webpack原理、常用loader.md">
            
                <span>
            
                    
                    webpack原理、常用loader
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">http</li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../http/报文结构、区别.md">
            
                <span>
            
                    
                    报文结构、区别
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="../http/网络攻击.md">
            
                <span>
            
                    
                    网络攻击
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">常见问题</li>
        
        
    
        <li class="chapter " data-level="8.1" data-path="../数组去重.md">
            
                <span>
            
                    
                    数组去重
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.2" data-path="../防抖节流.md">
            
                <span>
            
                    
                    防抖节流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.3" data-path="../手写promise.md">
            
                <span>
            
                    
                    手写promise
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.4" data-path="../类型判读、深浅拷贝.md">
            
                <span>
            
                    
                    类型判读、深浅拷贝
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.5" >
            
                <a target="_blank" href="https://juejin.cn/post/7030981812880932878">
            
                    
                    https://juejin.cn/post/7030981812880932878
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.6" >
            
                <a target="_blank" href="https://juejin.cn/post/6945625394154307592#heading-2">
            
                    
                    https://juejin.cn/post/6945625394154307592#heading-2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.7" >
            
                <a target="_blank" href="https://juejin.cn/user/3984285872165176/posts">
            
                    
                    https://juejin.cn/user/3984285872165176/posts
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.8" data-path="../常用方法封装.html">
            
                <a href="../常用方法封装.html">
            
                    
                    常用方法封装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.9" data-path="../总结.html">
            
                <a href="../总结.html">
            
                    
                    总结
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">前端资料</li>
        
        
    
        <li class="chapter " data-level="9.1" >
            
                <a target="_blank" href="https://underscorejs.org/">
            
                    
                    https://underscorejs.org/
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >同步、异步</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x540C;&#x6B65;&#x3001;&#x5F02;&#x6B65;">&#x540C;&#x6B65;&#x3001;&#x5F02;&#x6B65;</h1>
<blockquote>
<p>&#x6E38;&#x89C8;&#x5668;&#x662F;&#x591A;&#x7EBF;&#x7A0B;&#xFF0C;js&#x662F;&#x5355;&#x7EBF;&#x7A0B;&#x3002;</p>
</blockquote>
<h3 id="&#x540C;&#x6B65;">&#x540C;&#x6B65;</h3>
<p>&#x5F53;&#x4E00;&#x4E2A;&#x4EFB;&#x52A1;&#x6CA1;&#x6709;&#x6267;&#x884C;&#x5B8C;&#x6210;&#x65F6;&#xFF0C;&#x5176;&#x4F59;&#x4EFB;&#x52A1;&#x90FD;&#x9700;&#x8981;&#x7B49;&#x5F85;&#x4E0A;&#x4E00;&#x4E2A;&#x4EFB;&#x52A1;&#x6267;&#x884C;&#x7ED3;&#x675F;&#x540E;&#x624D;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x3002;</p>
<h3 id="&#x5F02;&#x6B65;">&#x5F02;&#x6B65;</h3>
<p>&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#x4E0D;&#x8FDB;&#x5165;&#x4E3B;&#x7EBF;&#x7A0B;&#x800C;&#x662F;&#x8FDB;&#x5165;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#xFF0C;&#x5F53;&#x4E3B;&#x7EBF;&#x7A0B;&#x7A7A;&#x95F2;&#x7684;&#x65F6;&#x5019;&#x4F1A;&#x5230;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x4E2D;&#x67E5;&#x627E;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x7684;&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#x653E;&#x5230;&#x4E3B;&#x7EBF;&#x7A0B;&#x4E2D;&#x6267;&#x884C;&#x3002;</p>
<p>&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#x5982;&#x4E0B;&#xFF1A;</p>
<ul>
<li>&#x5B9A;&#x65F6;&#x5668;</li>
<li>&#x4E8B;&#x4EF6;&#x7ED1;&#x5B9A;</li>
<li>AJAX&#x8BF7;&#x6C42;</li>
<li>&#x56DE;&#x8C03;&#x51FD;&#x6570;</li>
<li>Promise/async/await</li>
</ul>
<h3 id="js&#x5355;&#x7EBF;&#x7A0B;">js&#x5355;&#x7EBF;&#x7A0B;</h3>
<p>&#x6E38;&#x89C8;&#x5668;&#x662F;&#x4E00;&#x4E2A;&#x591A;&#x7EBF;&#x7A0B;&#x67B6;&#x6784;&#x7A0B;&#x5E8F;&#x3002;</p>
<p><img src="../asstes/1647235170775.jpg" alt="1647235170775"></p>
<p>&#x6E32;&#x67D3;&#x8FDB;&#x7A0B;&#x4E0B;&#x7684;&#x591A;&#x7EBF;&#x7A0B;</p>
<p>GUI&#x7EBF;&#x7A0B;&#xFF1A; &#x8D1F;&#x8D23;&#x6E32;&#x67D3;&#x5E03;&#x5C40;&#xFF0C;&#x89E3;&#x6790;html&#x3001;css&#xFF0C;&#x751F;&#x6210;DOM&#x6811;&#x548C;&#x6E32;&#x67D3;&#x6811;&#x3002;</p>
<p>js&#x5F15;&#x64CE;&#x7EBF;&#x7A0B;&#xFF1A;js&#x5F15;&#x64CE;&#x8D1F;&#x8D23;js&#x4EE3;&#x7801;&#x89E3;&#x6790;&#x6267;&#x884C;&#x3002;v8&#x5F15;&#x64CE;&#x5C31;&#x662F;&#x8DD1;&#x5728;js&#x5F15;&#x64CE;&#x4E0A;&#x7684;&#x3002;js&#x5F15;&#x64CE;&#x7EBF;&#x7A0B;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#xFF0C;&#x6240;&#x4EE5;js&#x662F;&#x5355;&#x7EBF;&#x7A0B;&#x3002;js&#x5F15;&#x64CE;&#x4E0E;GUI&#x7EBF;&#x7A0B;&#x4E92;&#x65A5;&#xFF0C;&#x5F53;&#x6E38;&#x89C8;&#x5668;&#x6267;&#x884C;js&#x7A0B;&#x5E8F;&#x7684;&#x65F6;&#x5019;&#xFF0C;GUI&#x7EBF;&#x7A0B;&#x4F1A;&#x88AB;&#x4FDD;&#x5B58;&#x5728;&#x4E00;&#x4E2A;&#x961F;&#x5217;&#x4E2D;&#x3002;&#x76F4;&#x5230;js&#x6267;&#x884C;&#x5B8C;&#x624D;&#x4F1A;&#x88AB;&#x6267;&#x884C;&#x3002;&#x5982;&#x679C;js&#x52A0;&#x8F7D;&#x65F6;&#x5019;&#x8FC7;&#x957F;&#x5C31;&#x4F1A;&#x5BFC;&#x81F4;&#x9875;&#x9762;&#x6E32;&#x67D3;&#x4E8B;&#x4EF6;&#x5EF6;&#x957F;&#x3002;</p>
<p>&#x5B9A;&#x65F6;&#x89E6;&#x53D1;&#x7EBF;&#x7A0B;&#xFF1A;&#x4E3A;&#x4EC0;&#x4E48;settimeout&#x4E0D;&#x4F1A;&#x963B;&#x585E;&#x4EE3;&#x7801;&#x8FD0;&#x884C;&#xFF0C;&#x56E0;&#x4E3A;settimeout&#x662F;&#x7531;&#x5B9A;&#x65F6;&#x89E6;&#x53D1;&#x7EBF;&#x7A0B;&#x540C;&#x65F6;&#x8FDB;&#x884C;&#x5904;&#x7406;&#xFF0C;&#x5F53;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x5B8C;&#x6210;&#x540E;&#x5B9A;&#x65F6;&#x89E6;&#x53D1;&#x7EBF;&#x7A0B;&#x4F1A;&#x901A;&#x77E5;&#x4E8B;&#x4EF6;&#x901A;&#x77E5;&#x7EBF;&#x7A0B;&#x5411;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x6DFB;&#x52A0;&#x4E8B;&#x4EF6;&#x3002;</p>
<p>&#x4E8B;&#x4EF6;&#x89E6;&#x53D1;&#x7EBF;&#x7A0B;&#xFF1A;&#x5C06;&#x6EE1;&#x8DB3;&#x89E6;&#x53D1;&#x6761;&#x4EF6;&#x7684;&#x4EFB;&#x52A1;&#x653E;&#x5230;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x4E2D;&#x3002;</p>
<p>&#x5F02;&#x6B65;http&#x8BF7;&#x6C42;&#x7EBF;&#x7A0B;&#xFF1A;&#x7528;&#x6765;&#x5904;&#x7406;ajax&#x8BF7;&#x6C42;&#xFF0C;&#x8BF7;&#x6C42;&#x5B8C;&#x6210;&#x65F6;&#x5982;&#x679C;&#x6709;&#x56DE;&#x8C03;&#x51FD;&#x6570;&#x901A;&#x77E5;&#x4E8B;&#x4EF6;&#x89E6;&#x53D1;&#x7EBF;&#x7A0B;&#x5411;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x4E2D;&#x63A8;&#x9001;&#x3002;</p>
<h3 id="&#x5B9A;&#x65F6;&#x5668;">&#x5B9A;&#x65F6;&#x5668;</h3>
<p>&#x5B9A;&#x65F6;&#x5668;&#x8BBE;&#x7F6E;&#x4E00;&#x4E2A;&#x7B49;&#x5F85;&#x65F6;&#x95F4;&#xFF0C;&#x5230;&#x8FBE;&#x65F6;&#x95F4;&#x540E;&#x4E0D;&#x4E00;&#x5B9A;&#x7ACB;&#x5373;&#x6267;&#x884C;&#xFF0C;&#x9700;&#x8981;&#x7B49;&#x5230;&#x4E3B;&#x7EBF;&#x7A0B;&#x7A7A;&#x95F2;&#x624D;&#x80FD;&#x88AB;&#x5B89;&#x6392;&#x6267;&#x884C;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">1</span>)
setTimeout(()=&gt;{
  <span class="hljs-built_in">console</span>.log(<span class="hljs-number">2</span>)
}&#xFF0C;<span class="hljs-number">3000</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-number">3</span>)
</code></pre>
<p>&#x4E0A;&#x8FF0;&#x4EE3;&#x7801;&#x6267;&#x884C;&#x987A;&#x5E8F;&#x5982;&#x4E0B;&#xFF1A;</p>
<ol>
<li><code>console.log(1)</code> &#xFF0C;&#x5165;&#x6808;&#x6267;&#x884C;&#xFF0C;&#x6267;&#x884C;&#x540E;&#x51FA;&#x6808;&#x3002;</li>
<li>&#x4EE3;&#x7801;&#x6267;&#x884C;&#x9047;&#x5230;<code>setTimeout</code>&#xFF0C;&#x8C03;&#x7528;&#x5236;&#x5B9A;webapi&#xFF0C;&#x901A;&#x77E5;&#x5B9A;&#x65F6;&#x5668;&#x89E6;&#x53D1;&#x7EBF;&#x7A0B;&#x5B9A;&#x65F6;3000ms&#x3002;</li>
<li><code>console.log(3)</code> &#xFF0C;&#x5165;&#x6808;&#x6267;&#x884C;&#xFF0C;&#x6267;&#x884C;&#x540E;&#x51FA;&#x6808;&#x3002;</li>
<li>&#x6267;&#x884C;&#x6808;&#x4E3A;&#x7A7A;&#xFF0C;&#x5B9A;&#x671F;&#x53BB;&#x68C0;&#x67E5;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#xFF0C;&#x6B64;&#x65F6;&#x8FD8;&#x6CA1;&#x6709;&#x5230;3s&#xFF0C;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x4E2D;&#x6CA1;&#x6709;&#x4EFB;&#x52A1;&#x3002;3s&#x540E;&#x4E8B;&#x4EF6;&#x89E6;&#x53D1;&#x7EBF;&#x7A0B;&#x5411;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x63A8;&#x9001;&#x5B9A;&#x65F6;&#x5668;&#x4E8B;&#x4EF6;&#xFF0C;&#x6267;&#x884C;&#x6808;&#x4E3A;&#x7A7A;&#x65F6;&#x68C0;&#x67E5;&#x5230;&#x4E86;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x4E2D;&#x7684;&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#xFF0C;&#x653E;&#x5165;&#x6808;&#x4E2D;&#x6267;&#x884C;&#x3002;</li>
</ol>
<h3 id="&#x4E8B;&#x4EF6;&#x5FAA;&#x73AF;&#x673A;&#x5236;"><strong>&#x4E8B;&#x4EF6;&#x5FAA;&#x73AF;&#x673A;&#x5236;</strong></h3>
<p>&#x9996;&#x5148;js&#x662F;&#x5355;&#x7EBF;&#x7A0B;&#xFF0C;&#x5F53;&#x6240;&#x6709;&#x4EFB;&#x52A1;&#x90FD;&#x5728;&#x4E00;&#x4E2A;&#x7EBF;&#x7A0B;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x9047;&#x5230;&#x4E00;&#x4E2A;&#x8017;&#x65F6;&#x4EFB;&#x52A1;&#xFF0C;&#x53EF;&#x80FD;&#x7F51;&#x9875;&#x4F1A;&#x51FA;&#x73B0;&#x5047;&#x6B7B;&#x65E0;&#x6CD5;&#x54CD;&#x5E94;&#x3002;&#x4E8B;&#x4EF6;&#x5FAA;&#x73AF;&#x662F;&#x540C;&#x4E8E;&#x7B49;&#x5F85;&#x548C;&#x53D1;&#x9001;&#x4FE1;&#x606F;&#x7684;&#x4E8B;&#x4EF6;&#x3002;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E3A;&#x7A0B;&#x5E8F;&#x8BBE;&#x7F6E;&#x4E86;&#x4E24;&#x4E2A;&#x7EBF;&#x7A0B;&#xFF0C;&#x4E00;&#x4E2A;&#x8D1F;&#x8D23;&#x7A0B;&#x5E8F;&#x672C;&#x8EAB;&#x7684;&#x8FD0;&#x884C;&#xFF0C;&#x6210;&#x4E3A;&#x4E3B;&#x7EBF;&#x7A0B;&#x3002;&#x53E6;&#x4E00;&#x4E2A;&#x8D1F;&#x8D23;&#x4E3B;&#x7EBF;&#x7A0B;&#x548C;&#x5176;&#x4ED6;&#x7EBF;&#x7A0B;&#x7684;&#x901A;&#x4FE1;&#x88AB;&#x79F0;&#x4E3A;&#x201C;eventloop&#x201D;&#x7EBF;&#x7A0B;&#x3002;</p>
<p>&#x6E38;&#x89C8;&#x5668;&#x7684;&#x5F02;&#x6B65;&#x5B9E;&#x73B0;&#xFF1A;</p>
<ul>
<li>&#x5B8F;&#x89C2;&#xFF1A;&#x6E38;&#x89C8;&#x5668;&#x7684;&#x591A;&#x7EBF;&#x7A0B;</li>
<li>&#x5FAE;&#x89C2;&#xFF1A;&#x4E8B;&#x4EF6;&#x5FAA;&#x73AF;</li>
</ul>
<p>&#x5B8F;&#x4EFB;&#x52A1;&#x548C;&#x5FAE;&#x4EFB;&#x52A1;&#xFF1A;</p>
<p>&#x5B8F;&#x4EFB;&#x52A1;&#xFF1A;</p>
<ol>
<li>script</li>
<li>setImmediate</li>
<li>setTimeot/setInterval</li>
<li>requestAnimationFrame</li>
<li>I/O</li>
<li>UI rendering</li>
</ol>
<p>&#x5FAE;&#x4EFB;&#x52A1;&#xFF1A;</p>
<ol>
<li>Object.observe</li>
<li>MutationObserver:</li>
<li>postMessage</li>
<li>Promise</li>
</ol>
<p>&#x4E8B;&#x4EF6;&#x5FAA;&#x73AF;&#x6D41;&#x7A0B;&#xFF1A;&#x6267;&#x884C;&#x6808;&#x4E3A;&#x7A7A;&#x5230;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x4E2D;&#x67E5;&#x627E;&#x5FAE;&#x4EFB;&#x52A1;&#x6267;&#x884C;&#x6267;&#x884C;&#xFF0C;&#x9075;&#x5FAA;&#x5148;&#x5165;&#x5148;&#x51FA;&#x7684;&#x64CD;&#x4F5C;&#x3002;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x4E2D;&#x7684;&#x5FAE;&#x4EFB;&#x52A1;&#x6E05;&#x7A7A;&#x65F6;&#xFF0C;&#x6B64;&#x65F6;&#x4F1A;&#x5224;&#x65AD;&#x662F;&#x5426;&#x9700;&#x8981;&#x91CD;&#x65B0;&#x6E32;&#x67D3;&#xFF0C;&#x4E4B;&#x540E;&#x5728;&#x8FDB;&#x884C;&#x5B8F;&#x4EFB;&#x52A1;&#x7684;&#x6267;&#x884C;&#x3002;&#x4F9D;&#x6B64;&#x7C7B;&#x63A8;&#x3002;</p>
<h3 id="&#x5F02;&#x6B65;&#x7F16;&#x7A0B;">&#x5F02;&#x6B65;&#x7F16;&#x7A0B;</h3>
<ul>
<li>&#x56DE;&#x6389;&#x51FD;&#x6570;</li>
<li>&#x53D1;&#x5E03;/&#x8BA2;&#x9605;</li>
<li>Promise</li>
<li>Async</li>
<li>Generator</li>
</ul>
<p>&#x56DE;&#x8C03;&#x51FD;&#x6570;</p>
<pre><code>function myCallback(text,callback){
  callback &amp;&amp; callback()
}
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="class.md" class="navigation navigation-prev " aria-label="Previous page: class">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../计算机基础/进程、线程、cpu、内存.md" class="navigation navigation-next " aria-label="Next page: 进程、线程、cpu、内存">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"同步、异步","level":"2.18","depth":1,"next":{"title":"进程、线程、cpu、内存","level":"3.1","depth":1,"path":"计算机基础/进程、线程、cpu、内存.md","ref":"计算机基础/进程、线程、cpu、内存.md","articles":[]},"previous":{"title":"class","level":"2.17","depth":1,"path":"Js部分/class.md","ref":"Js部分/class.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"Js部分/同步、异步.md","mtime":"2022-03-14T07:18:03.013Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-03-15T14:16:54.870Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

